# -*- coding: utf-8 -*-
# @Time    : 2021/11/19 10:00
# @Author  : TangDagui
# @Email   : 3297364807@qq.com
# @File    : PythonThree.py
# @Software: PyCharm

import math

for i in range(2, 1000):
    array = []  # 因子列表，i 每次循环都清空
    for j in range(1, math.floor(i / 2) + 1):
        if i % j == 0:
            array.append(j)
    if sum(array) == i:
        print("{0}等于{1},中{2}个元素的和，所以是完数".format(i, array, len(array)))
